{extend name="base" /} {block name="body"}
<div class="right">
	<div class="rigtop">
		<span class="title">地址管理</span>
	</div>
	<div class="indrig_con orders_con">
		<div class="zizh_btnbox online_btnbox">
			<button class="zizh_btn" type="button" onclick="dz_add('{:url('shop/dz_add')}')">添加地址</button>
		</div>

		<div class="orders_content" style="margin-top: 0px;">
			<table class="zizh_table1">
				<thead>
					<tr>
						<th>名称</th>
						<th>地址</th>
						<th>电话</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody id="tbody">
					{volist name="res" id="vo" empty="$empty"}
					<tr>
						<td>{$vo.name|default='0'}</td>
						<td>{$vo.address|default='0'}</td>
						<td>{$vo.mobile|default='0'}</td>
						<td>
							<a href="javascript:;" class="gray" onclick="dz_edit('{:url('shop/dz_edit',['id'=>$vo.id])}')">编辑</a>
							<a class="ajax-delete" onclick="del('{$vo.id}')">删除</a>
						</td>
					</tr>
					{/volist}
				</tbody>
			</table>
			<div class="fenye" style="display: block;">

			</div>
		</div>
	</div>
</div>

{/block} {block name="script"}
<script>
	function dz_add(url) {
		layer.open({
			type: 2,
			title: '添加地址',
			shadeClose: true,
			shade: 0.8,
			area: ['70%', '90%'],
			content: url
		});
	}

	function dz_edit(url) {
		layer.open({
			type: 2,
			title: '编辑地址',
			shadeClose: true,
			shade: 0.8,
			area: ['70%', '90%'],
			content: url
		});
	}

	function del(obj) {
		layer.confirm('确认要删除吗?', {
			btn: ['确认', '取消'], //可以无限个按钮,
		}, function(index) {
			$.ajax({
				type: "post",
				url: "{:url('shop/del')}",
				data: {
					id: obj
				}, //表单数据
				success: function(data) {
					layer.msg(data.msg, function(index) {
						location.href = data.url;

					});

				}
			});

		});

	}
</script>
{/block}